package net.joey.file;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileReaderDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			FileReader fr = new FileReader("AFile.java");
			FileWriter fw = new FileWriter("CopyFileWriterAFile.cc");
//			FileReader fr = new FileReader("01.jpg");
//			FileWriter fw = new FileWriter("CopyFileWriter01.jpg");
			int r = -1;
			while((r = fr.read()) != -1){
				fw.write(r);
				System.out.println(Integer.toHexString(r));
				System.out.println((char)r);
			}
			fr.close();
			fw.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
